{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "ymsq1Lw0VEqT"
      },
      "source": [
        "# Agent Generate Structured Output Examples\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "7V3aV16AmY0K"
      },
      "source": [
        "You can also check this cookbook in colab [here](https://colab.research.google.com/drive/1DioOS4t0L4Lb3rPKAnIjCl-IyvkW6fOr?usp=sharing)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "UvHRdXwflAz-"
      },
      "source": [
        "<div class=\"align-center\">\n",
        "  <a href=\"https://www.camel-ai.org/\"><img src=\"https://i.postimg.cc/KzQ5rfBC/button.png\"width=\"150\"></a>\n",
        "  <a href=\"https://discord.camel-ai.org\"><img src=\"https://i.postimg.cc/L4wPdG9N/join-2.png\"  width=\"150\"></a></a>\n",
        "  \n",
        "⭐ <i>Star us on [*Github*](https://github.com/camel-ai/camel), join our [*Discord*](https://discord.camel-ai.org) or follow our [*X*](https://x.com/camelaiorg)\n",
        "</div>"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "G5gE04UuPUWj"
      },
      "source": [
        "This notebook demonstrates how to use CAMEL agents to generate structured outputs from language models. You'll learn to create AI agents that produce consistent, well-formatted responses that can be directly used in your applications.\n",
        "\n",
        "\n",
        "In this notebook, you'll explore:\n",
        "\n",
        "* **CAMEL**: A powerful multi-agent framework that enables Retrieval-Augmented Generation and multi-agent role-playing scenarios, allowing for sophisticated AI-driven tasks.\n",
        "* **Structured Outputs**: How to define and enforce specific response schemas using Pydantic models, ensuring consistent and reliable model outputs.\n",
        "* **Tool Integration**: Techniques for combining structured responses with CAMEL's tool system to create powerful, interactive AI applications.\n",
        "* **Cross-Model Compatibility**: Strategies for achieving structured outputs even with models that don't natively support function calling or structured responses."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "0J0_iW-YVcq2"
      },
      "source": [
        "## 📦 Installation"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "7p-JjpyNVcCT"
      },
      "source": [
        "First, install the CAMEL package with all its dependencies:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": true,
        "id": "0GXs2pruU9Vl"
      },
      "outputs": [],
      "source": [
        "!pip install \"camel-ai[all]==0.2.70\""
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "lfNvFbhD6o8B"
      },
      "source": [
        "## 🔑 Setting Up API Keys"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "jqV12oQfQTyl"
      },
      "source": [
        "You'll need to set up your API keys for OpenAI. This ensures that the tools can interact with external services securely."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {},
      "outputs": [],
      "source": [
        "import os\n",
        "from getpass import getpass\n",
        "\n",
        "# Prompt for the AgentOps API key securely\n",
        "openai_api_key = getpass('Enter your API key: ')\n",
        "os.environ[\"OPENAI_API_KEY\"] = openai_api_key"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "___"
      },
      "source": [
        "## 1. Basic Structured Response"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "6f64VOMMP93d"
      },
      "source": [
        "\n",
        "The simplest way to get structured responses is by defining a Pydantic model and using it as the `response_format` parameter. This ensures the model's output matches your expected structure。\n",
        "\n",
        "Lets create a simple agent that returns a Joke with Structured Response\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "1. **Model Initialization**:\n",
        "   - We create a chat agent with a default model\n",
        "   - The system message sets the assistant's behavior\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 6,
      "metadata": {
        "id": "gE_qBFCVveBR"
      },
      "outputs": [],
      "source": [
        "from pydantic import BaseModel, Field\n",
        "from camel.agents import ChatAgent\n",
        "from camel.models import ModelFactory\n",
        "from camel.types import ModelPlatformType, ModelType\n",
        "\n",
        "# Define system message\n",
        "assistant_sys_msg = \"You are a helpful assistant.\"\n",
        "\n",
        "# Initialize model and agent\n",
        "model = ModelFactory.create(\n",
        "    model_platform=ModelPlatformType.DEFAULT,\n",
        "    model_type=ModelType.DEFAULT,\n",
        ")\n",
        "agent = ChatAgent(assistant_sys_msg, model=model)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "2. **Response Structure**:\n",
        "   - We define a [JokeResponse](camel/examples/structured_response/json_format_response.py:33:0-35:69) class using Pydantic's `BaseModel`\n",
        "   - Each field has a type hint and a description\n",
        "   - The model uses these descriptions to generate appropriate content\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 19,
      "metadata": {},
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "=== Raw Response ===\n",
            "{\"joke\":\"Why did the tomato turn red? Because it saw the salad dressing!\",\"funny_level\":7}\n",
            "\n",
            "=== Parsed Object ===\n",
            "joke='Why did the tomato turn red? Because it saw the salad dressing!' funny_level=7\n",
            "\n",
            "=== Type of Parsed Object ===\n",
            "<class '__main__.JokeResponse'>\n"
          ]
        }
      ],
      "source": [
        "# Define the expected response structure using Pydantic\n",
        "class JokeResponse(BaseModel):\n",
        "    joke: str = Field(description=\"A funny joke\")\n",
        "    funny_level: int = Field(description=\"How funny the joke is, from 1 to 10\")\n",
        "\n",
        "response = agent.step(\"Tell me a joke.\", response_format=JokeResponse)\n",
        "\n",
        "\n",
        "# Display the results\n",
        "print(\"=== Raw Response ===\")\n",
        "print(response.msgs[0].content)\n",
        "\n",
        "print(\"\\n=== Parsed Object ===\")\n",
        "print(response.msgs[0].parsed)\n",
        "\n",
        "print(\"\\n=== Type of Parsed Object ===\")\n",
        "print(type(response.msgs[0].parsed))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## 2. Structured Response with Tools <a name=\"with-tools\"></a>\n",
        "\n",
        "In this section, we'll demonstrate how to combine structured responses with CAMEL's tool system. This allows the model to perform calculations and searches while maintaining a structured output format.\n",
        "\n",
        "Let's create an example where we ask the model to perform a calculation and return the result in a structured format:\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "1. **Import required libraries**:\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 23,
      "metadata": {},
      "outputs": [],
      "source": [
        "from pydantic import BaseModel, Field\n",
        "from camel.agents import ChatAgent\n",
        "from camel.configs.openai_config import ChatGPTConfig\n",
        "from camel.models import ModelFactory\n",
        "from camel.toolkits import MathToolkit, SearchToolkit\n",
        "from camel.types import ModelPlatformType, ModelType"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "2. **Tool Integration**:\n",
        "   - We import and initialize `MathToolkit` and `SearchToolkit` to give the model calculation and search capabilities\n",
        "   - These tools are passed to the `ChatAgent` during initialization"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 24,
      "metadata": {},
      "outputs": [],
      "source": [
        "# Use wiki tool to avoid additional api config\n",
        "search_tools = SearchToolkit().get_tools()\n",
        "wiki_tool = search_tools[0]\n",
        "\n",
        "tools_list = [\n",
        "    *MathToolkit().get_tools(),  # Adds math calculation capabilities\n",
        "    wiki_tool,  # Adds web search capabilities\n",
        "]\n",
        "\n",
        "# Configure model with specific settings\n",
        "assistant_model_config = ChatGPTConfig(\n",
        "    temperature=0.0,  # Use low temperature for more deterministic outputs\n",
        ")\n",
        "\n",
        "# Define system message\n",
        "assistant_sys_msg = \"You are a helpful assistant that's good at calculations and research.\"\n",
        "\n",
        "# Cell 3: Initialize the model\n",
        "model = ModelFactory.create(\n",
        "    model_platform=ModelPlatformType.DEFAULT,\n",
        "    model_type=ModelType.DEFAULT,\n",
        "    model_config_dict=assistant_model_config.as_dict(),\n",
        ")\n",
        "\n",
        "# Initialize agent with tools\n",
        "camel_agent = ChatAgent(\n",
        "    assistant_sys_msg,\n",
        "    model=model,\n",
        "    tools=tools_list,  # Pass the tools to the agent\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "3. **Structured Response**:\n",
        "   - We define a `CalculationResult` Pydantic model with three fields\n",
        "   - The model uses available tools to perform calculations while maintaining the specified output structure"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 25,
      "metadata": {},
      "outputs": [],
      "source": [
        "# Define the structured response format\n",
        "class CalculationResult(BaseModel):\n",
        "    current_age: str = Field(description=\"The current age being calculated\")\n",
        "    calculated_age: str = Field(description=\"The age after adding years\")\n",
        "    calculation_steps: str = Field(description=\"Detailed steps of the calculation\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "4. **Execution Flow**:\n",
        "   - The model first uses search tools to find the founding year of the University of Oxford\n",
        "   - It then performs the age calculation using math tools\n",
        "   - Finally, it formats the response according to our `CalculationResult` schema\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 26,
      "metadata": {},
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "=== Raw Response ===\n",
            "{\"current_age\":\"928 years\",\"calculated_age\":\"938 years\",\"calculation_steps\":\"The University of Oxford was established in 1096. Assuming the current year is 2024, the current age is calculated as 2024 - 1096 = 928 years. Adding 10 more years to this age results in 928 + 10 = 938 years.\"}\n",
            "\n",
            "=== Parsed Object ===\n",
            "current_age='928 years' calculated_age='938 years' calculation_steps='The University of Oxford was established in 1096. Assuming the current year is 2024, the current age is calculated as 2024 - 1096 = 928 years. Adding 10 more years to this age results in 928 + 10 = 938 years.'\n",
            "\n",
            "=== Accessing Fields ===\n",
            "Current age: 928 years\n",
            "Calculated age: 938 years\n",
            "\n",
            "Calculation steps:\n",
            "The University of Oxford was established in 1096. Assuming the current year is 2024, the current age is calculated as 2024 - 1096 = 928 years. Adding 10 more years to this age results in 928 + 10 = 938 years.\n"
          ]
        }
      ],
      "source": [
        "# Define the user's question\n",
        "user_msg = \"\"\"Assume now is 2024 in the Gregorian calendar, \n",
        "estimate the current age of University of Oxford \n",
        "and then add 10 more years to this age.\"\"\"\n",
        "\n",
        "# Get the structured response\n",
        "response = camel_agent.step(\n",
        "    user_msg, \n",
        "    response_format=CalculationResult\n",
        ")\n",
        "\n",
        "# Display the results\n",
        "print(\"=== Raw Response ===\")\n",
        "print(response.msgs[0].content)\n",
        "\n",
        "print(\"\\n=== Parsed Object ===\")\n",
        "print(response.msgs[0].parsed)\n",
        "\n",
        "print(\"\\n=== Accessing Fields ===\")\n",
        "print(f\"Current age: {response.msgs[0].parsed.current_age}\")\n",
        "print(f\"Calculated age: {response.msgs[0].parsed.calculated_age}\")\n",
        "print(f\"\\nCalculation steps:\\n{response.msgs[0].parsed.calculation_steps}\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## 3. Structured Response with Non-Native Models <a name=\"non-native\"></a>\n",
        "\n",
        "Some models don't natively support structured output formats. In this section, we'll show how to achieve structured responses through prompt engineering using GPT 3.5 TURBO. This approach is particularly useful with open-source or custom models.\n",
        "\n",
        "Let's create a recipe generator that returns structured data, demonstrating how to work with models that don't support native structured output:"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "1. **Import libraries**:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 12,
      "metadata": {},
      "outputs": [],
      "source": [
        "from pydantic import BaseModel, Field\n",
        "from typing import List, Optional\n",
        "from camel.agents import ChatAgent\n",
        "from camel.models import ModelFactory\n",
        "from camel.types import ModelPlatformType, ModelType\n",
        "import json"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "2. **Model-Agnostic Approach**:\n",
        "   - We define our data structure using Pydantic models"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 14,
      "metadata": {},
      "outputs": [],
      "source": [
        "# Define Pydantic models for our data structure\n",
        "# Define our data models\n",
        "class Ingredient(BaseModel):\n",
        "    name: str\n",
        "    amount: str\n",
        "    unit: str\n",
        "\n",
        "class RecipeStep(BaseModel):\n",
        "    step_number: int\n",
        "    instruction: str\n",
        "    duration: str\n",
        "\n",
        "class Recipe(BaseModel):\n",
        "    name: str\n",
        "    description: str\n",
        "    prep_time: str\n",
        "    cook_time: str\n",
        "    servings: int\n",
        "    ingredients: List[Ingredient]\n",
        "    instructions: List[RecipeStep]\n",
        "    dietary_info: List[str] = Field(description=\"List of dietary categories\")\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "3. **Define agent and recipe generator function**\n",
        "   - The `generate_recipe` function manually constructs a prompt that asks for JSON\n",
        "   - We handle the response parsing and validation manually"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 15,
      "metadata": {},
      "outputs": [],
      "source": [
        "# Cell 2: Initialize the default model\n",
        "model = ModelFactory.create(\n",
        "    model_platform=ModelPlatformType.DEFAULT,\n",
        "    model_type=ModelType.GPT_3_5_TURBO,\n",
        "    api_key=openai_api_key,\n",
        ")\n",
        "\n",
        "agent = ChatAgent(\"You are a professional chef assistant.\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 16,
      "metadata": {},
      "outputs": [],
      "source": [
        "# Function to demonstrate manual parsing\n",
        "def generate_recipe(dish: str) -> Recipe:\n",
        "    # First, get a structured response\n",
        "    response = agent.step(\n",
        "        f\"Provide a detailed recipe for {dish} in JSON format with the following structure: \"\n",
        "        \"{\\\"name\\\": \\\"...\\\", \\\"description\\\": \\\"...\\\", \\\"prep_time\\\": \\\"...\\\", \"\n",
        "        \"\\\"cook_time\\\": \\\"...\\\", \\\"servings\\\": 0, \\\"ingredients\\\": [{\\\"name\\\": \\\"...\\\", \"\n",
        "        \"\\\"amount\\\": \\\"...\\\", \\\"unit\\\": \\\"...\\\"}], \\\"instructions\\\": [{\\\"step_number\\\": 1, \"\n",
        "        \"\\\"instruction\\\": \\\"...\\\", \\\"duration\\\": \\\"...\\\"}], \\\"dietary_info\\\": [\\\"...\\\"]}\\n\\n\"\n",
        "        \"Return ONLY the JSON object, without any additional text or markdown formatting.\"\n",
        "    )\n",
        "    \n",
        "    try:\n",
        "        # Extract JSON from the response\n",
        "        content = response.msgs[0].content.strip()\n",
        "        if content.startswith(\"```json\"):\n",
        "            content = content[7:-3].strip()  # Remove markdown code block if present\n",
        "        \n",
        "        # Parse and validate the response\n",
        "        recipe_data = json.loads(content)\n",
        "        return Recipe(**recipe_data)\n",
        "    except Exception as e:\n",
        "        print(f\"Error parsing response: {e}\")\n",
        "        print(\"Raw response:\", response.msgs[0].content)\n",
        "        raise"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "4.1. **Generate and display a recipe**\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 17,
      "metadata": {},
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "=== VEGETABLE LASAGNA ===\n",
            "A hearty and flavorful vegetable lasagna layered with ricotta, mozzarella, tomato sauce, and a variety of fresh vegetables.\n",
            "\n",
            "Preparation: 30 minutes | Cooking: 45 minutes | Servings: 6\n",
            "\n",
            "INGREDIENTS:\n",
            "- 2 tablespoons olive oil\n",
            "- 1 medium, chopped onion\n",
            "- 3 minced garlic cloves\n",
            "- 1 medium, sliced zucchini\n",
            "- 1 medium, chopped bell pepper\n",
            "- 1 cup, sliced mushrooms\n",
            "- 2 cups, fresh spinach\n",
            "- 4 cups tomato sauce\n",
            "- 12 noodles lasagna noodles\n",
            "- 2 cups ricotta cheese\n",
            "- 2 cups, shredded mozzarella cheese\n",
            "- 1/2 cup, grated parmesan cheese\n",
            "- 1 large egg\n",
            "- 1 teaspoon salt\n",
            "- 1/2 teaspoon black pepper\n",
            "- 1 teaspoon dried oregano\n",
            "- 1 teaspoon dried basil\n",
            "\n",
            "INSTRUCTIONS:\n",
            "1. Preheat oven to 375°F (190°C). (5 minutes)\n",
            "2. In a large skillet, heat olive oil over medium heat. Add chopped onion and minced garlic; sauté until softened, about 3-4 minutes. (5 minutes)\n",
            "3. Add sliced zucchini, chopped bell pepper, and mushrooms to the skillet. Cook until vegetables are tender, about 7-8 minutes. (8 minutes)\n",
            "4. Stir in fresh spinach and cook until wilted, about 2 minutes. Remove from heat and set aside. (3 minutes)\n",
            "5. In a mixing bowl, combine ricotta cheese, egg, salt, black pepper, dried oregano, and dried basil. (3 minutes)\n",
            "6. Spread a thin layer of tomato sauce on the bottom of a 9x13 inch baking dish. (2 minutes)\n",
            "7. Place 3-4 lasagna noodles on top of the sauce layer. (2 minutes)\n",
            "8. Spread one-third of the ricotta mixture over the noodles, then half of the sautéed vegetables, followed by 1 cup of tomato sauce and 2/3 cup of shredded mozzarella. (5 minutes)\n",
            "9. Repeat the layering process (noodles, ricotta, vegetables, sauce, mozzarella) once more. (5 minutes)\n",
            "10. Add a final layer of noodles topped with the remaining tomato sauce, mozzarella, and grated parmesan cheese. (3 minutes)\n",
            "11. Cover the dish with aluminum foil and bake in the preheated oven for 30 minutes. (30 minutes)\n",
            "12. Remove foil and bake uncovered for an additional 10-15 minutes, until cheese is bubbly and golden. (15 minutes)\n",
            "13. Let lasagna rest for 10 minutes before serving. (10 minutes)\n",
            "\n",
            "DIETARY INFO: vegetarian, contains dairy, contains gluten\n"
          ]
        }
      ],
      "source": [
        "# Cell 4: Generate and display a recipe\n",
        "try:\n",
        "    recipe = generate_recipe(\"vegetable lasagna\")\n",
        "    \n",
        "    print(f\"=== {recipe.name.upper()} ===\")\n",
        "    print(recipe.description)\n",
        "    print(f\"\\nPreparation: {recipe.prep_time} | Cooking: {recipe.cook_time} | Servings: {recipe.servings}\")\n",
        "    \n",
        "    print(\"\\nINGREDIENTS:\")\n",
        "    for ing in recipe.ingredients:\n",
        "        print(f\"- {ing.amount} {ing.unit} {ing.name}\")\n",
        "    \n",
        "    print(\"\\nINSTRUCTIONS:\")\n",
        "    for step in recipe.instructions:\n",
        "        print(f\"{step.step_number}. {step.instruction} ({step.duration})\")\n",
        "    \n",
        "    print(\"\\nDIETARY INFO:\", \", \".join(recipe.dietary_info))\n",
        "\n",
        "except Exception as e:\n",
        "    print(f\"Failed to generate recipe: {e}\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "4.2. **Alternative approach**\n",
        "- Using response_format with the default model \n",
        "- This shows how it would work with a model that supports structured output**"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 18,
      "metadata": {},
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "\n",
            "=== Using response_format ===\n",
            "Recipe name: Vegetable Lasagna\n",
            "First ingredient: olive oil\n"
          ]
        }
      ],
      "source": [
        "# Cell 5: Alternative approach - Using response_format with the default model\n",
        "# This shows how it would work with a model that supports structured output\n",
        "try:\n",
        "    response = agent.step(\n",
        "        \"Give me a recipe for vegetable lasagna\",\n",
        "        response_format=Recipe\n",
        "    )\n",
        "    \n",
        "    print(\"\\n=== Using response_format ===\")\n",
        "    print(\"Recipe name:\", response.msgs[0].parsed.name)\n",
        "    print(\"First ingredient:\", response.msgs[0].parsed.ingredients[0].name)\n",
        "    \n",
        "except Exception as e:\n",
        "    print(\"\\nNote: The default model might not support structured output natively.\")\n",
        "    print(\"Error:\", e)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "flYNal6-R4yR"
      },
      "source": [
        "## 🌟 Highlights"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "SmkXhy4JR726"
      },
      "source": [
        "## Conclusion\n",
        "\n",
        "This notebook has guided you through the powerful capabilities of structured responses in CAMEL, from basic implementations to advanced use cases. By leveraging Pydantic models and CAMEL's flexible architecture, you can create robust, type-safe interactions with language models.\n",
        "\n",
        "### Key Highlights\n",
        "\n",
        "* **Type-Safe Outputs**: Ensure consistent data structures with Pydantic models\n",
        "* **Flexible Integration**: Works with various model types, including those without native structured output support\n",
        "* **Tool Compatibility**: Seamlessly combine structured responses with CAMEL's tool system\n",
        "\n",
        "### Key Tools Utilized\n",
        "\n",
        "* **CAMEL**: A powerful multi-agent framework that enables Retrieval-Augmented Generation and multi-agent role-playing scenarios, allowing for sophisticated AI-driven tasks.\n",
        "* **Pydantic**: Provides data validation and settings management using Python type annotations.\n",
        "* **Structured Outputs**: Enforce specific response formats for reliable data processing.\n",
        "\n",
        "### Next Steps\n",
        "\n",
        "This comprehensive setup allows you to adapt and expand the example for various scenarios, including:\n",
        "\n",
        "* Building data processing pipelines\n",
        "* Creating structured APIs with LLMs\n",
        "* Developing complex multi-agent systems\n",
        "* Implementing data validation and transformation workflows\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "s6Det-fcMb9A"
      },
      "source": [
        "That's everything: Got questions about 🐫 CAMEL-AI? Join us on [Discord](https://discord.camel-ai.org)! Whether you want to share feedback, explore the latest in multi-agent systems, get support, or connect with others on exciting projects, we’d love to have you in the community! 🤝\n",
        "\n",
        "Check out some of our other work:\n",
        "\n",
        "1. 🐫 Creating Your First CAMEL Agent [free Colab](https://docs.camel-ai.org/cookbooks/create_your_first_agent.html)\n",
        "\n",
        "2.  Graph RAG Cookbook [free Colab](https://colab.research.google.com/drive/1uZKQSuu0qW6ukkuSv9TukLB9bVaS1H0U?usp=sharing)\n",
        "\n",
        "3. 🧑‍⚖️ Create A Hackathon Judge Committee with Workforce [free Colab](https://colab.research.google.com/drive/18ajYUMfwDx3WyrjHow3EvUMpKQDcrLtr?usp=sharing)\n",
        "\n",
        "4. 🔥 3 ways to ingest data from websites with Firecrawl & CAMEL [free Colab](https://colab.research.google.com/drive/1lOmM3VmgR1hLwDKdeLGFve_75RFW0R9I?usp=sharing)\n",
        "\n",
        "5. 🦥 Agentic SFT Data Generation with CAMEL and Mistral Models, Fine-Tuned with Unsloth [free Colab](https://colab.research.google.com/drive/1lYgArBw7ARVPSpdwgKLYnp_NEXiNDOd-?usp=sharingg)\n",
        "\n",
        "Thanks from everyone at 🐫 CAMEL-AI\n",
        "\n",
        "\n",
        "<div class=\"align-center\">\n",
        "  <a href=\"https://www.camel-ai.org/\"><img src=\"https://i.postimg.cc/KzQ5rfBC/button.png\"width=\"150\"></a>\n",
        "  <a href=\"https://discord.camel-ai.org\"><img src=\"https://i.postimg.cc/L4wPdG9N/join-2.png\"  width=\"150\"></a></a>\n",
        "  \n",
        "⭐ <i>Star us on [*Github*](https://github.com/camel-ai/camel), join our [*Discord*](https://discord.camel-ai.org) or follow our [*X*](https://x.com/camelaiorg)\n",
        "</div>\n"
      ]
    }
  ],
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "display_name": "base",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.12.4"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}
